package com.itheima.service.ServiceImpl;

import com.itheima.mapper.EmpMapper;
import com.itheima.pojo.Emp;
import com.itheima.pojo.Pagebean;
import com.itheima.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmpServiceImpl implements EmpService {
    @Autowired
    private EmpMapper empMapper;
    @Override
    public Pagebean page(Integer currentPage, Integer pageSize) {
        Long total =  empMapper.count();
        Integer start =(currentPage-1)*pageSize;
        List<Emp> list= empMapper.page(start,pageSize);

        Pagebean pagebean=new Pagebean(total,list);
        return pagebean;
    }
}
